package ListNode;

import java.util.Scanner;

public class SortList {
    public static class ListNode{
        int val;
        ListNode next;
        ListNode(){}
        ListNode(int val){
            this.val = val;
        }
        ListNode(int val, ListNode next){
            this.val = val;
            this.next = next;
        }
    }
    public static ListNode sortList(ListNode head){
        if(head == null || head.next == null)
            return head;
        
        ListNode mid = findMid(head);
        ListNode left = head;
        ListNode right = mid.next;
        mid.next = null;

        ListNode sortedLeft = sortList(left);
        ListNode sortedRight = sortList(right);

        return mergeList(sortedLeft, sortedRight);
    }
    private static ListNode findMid(ListNode head){
        ListNode fast = head.next;
        ListNode slow = head;
        while(fast != null && fast.next != null){
            fast = fast.next.next;
            slow = slow.next;
        }
        return slow;
    }
    private static ListNode mergeList(ListNode h1, ListNode h2){
        ListNode dummy = new ListNode(-1);
        ListNode cur = dummy;
        while(h1 != null && h2 != null){
            if(h1.val < h2.val){
                cur.next = h1;
                h1 = h1.next;
                cur = cur.next;
            } else {
                cur.next = h2;
                h2 = h2.next;
                cur = cur.next;
            }
        }
        if(h1 != null) cur.next = h1;
        if(h2 != null) cur.next = h2;
        return dummy.next;
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] s = sc.nextLine().split(" ");
        ListNode dummy = new ListNode(-1);
        ListNode cur = dummy;
        for(int i = 0; i < s.length; i++){
            cur.next = new ListNode(Integer.parseInt(s[i]));
            cur = cur.next;
        }
        ListNode res = sortList(dummy.next);
        while(res != null){
            System.out.print(res.val + "->");
            res = res.next;
        }
        sc.close();
    }
}
